class @HomeView extends CustomView
    initialize: ->
        super
        @setElement($('#main'))
        @model.bind("change", @render)
        @model.fetch()

    events:
        "click .best-books-content ul.star-rating li a" : "rate"

    rate: (e) ->
        e.preventDefault()

        rating = $(e.currentTarget)
        ul = rating.closest("ul.star-rating:not(.disabled)")

        if ul.length > 0
            ratingModel = new RatingModel()
            ratingModel.set(
                "BookId": ul.data("val-bookid")
                "RatingValue": rating.data("rate-value")
            )

            ratingView = new RatingView(
                model: ratingModel
                el: $(ul)
            )
            ratingView.render()

    render: ->
        @GetTemplate(SiteMap.Home.IndexTemplate,(compiledTemplate) =>
            $(@el).html(compiledTemplate(@model.toJSON()))
        )